<?php
// +----------------------------------------------------------------------
// | 幕小铺
// +----------------------------------------------------------------------
// | 版权所有 2016~2019 幕小铺科技（大连）有限公司 [ http://www.XXX.com ]
// +----------------------------------------------------------------------
// | 2020/03/14 jason wang
// +----------------------------------------------------------------------

namespace app\common\controller;

use think\Controller;
use think\facade\Request;
/**
 * 接口安全验证
 * @package app\common\controller
 */
class AuthCheck extends Controller{

    /**
     * 初始化
     * @author jason wang
     */
    protected function initialize(){
        //权限安全校验（暂时关闭）
        //$this->check_auth();

        //分页赋值
        $page_size    = intval(input('page_size') ? input('page_size') : 10);
        config('paginate.list_rows', $page_size);
    }


    /**
     * 请求类型校验
     * @author jason wang
     */
    public function getParams($method = 0){
        $request_method = Request::instance() -> method();
        if ($method == 1 && 'POST' != $request_method){
            json_out(-9001, '请POST方法请求参数');
        }
        if ($method == 0 && $request_method != 'GET' ){
            json_out(-9002, '请GET方法请求参数');
        }
        $params = Request::instance() -> param();
        return $params;
    }

}